﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class KONG_ZI : MonoBehaviour, IEffectSettler
{
    // Start is called before the first frame update
     public void OnRoundStart() {

     }
    public void OnSettle() {

    }
    public void OnLeave() {

    }
    public void OnClick(int index) {
        switch(index) {
            case 0:
            Side side = VSController.Instance.GetCurrSide();
            if(side.Coin < 3) {
                Debug.LogError("技能费用不足！！！");
                break;
            }
            side.Coin -= 3;
            Card min = null, max = null;
            foreach(Card card in side.ExposedField) {
                if(card == null) continue;
                if(min == null) {
                    min = card;
                    max = card;
                    continue;
                }
                if(card.CE < min.CE) {
                    min = card;
                }
                if(card.CE > max.CE) {
                    max = card;
                }
            }
            foreach(Card card in side.HiddenField) {
                if(card == null) continue;
                if(min == null) {
                    min = card;
                    max = card;
                    continue;
                }
                if(card.CE < min.CE) {
                    min = card;
                }
                if(card.CE > max.CE) {
                    max = card;
                }
            }
            min.CE = max.CE;
            VSController.Instance.RefreshBoard();
                break;
            default:
                break;
        }
    }
}
